<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotRequest extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdPILOTREQUEST;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_REQUESTTEXT;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_servicedemande;
    
    
    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELANALYSE;


    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_WITHCHART;
    
    /**
     * Database var type varchar(512)
     *
     * @var string
     */
    protected $_LABELRequest;


    /**
     * Parent relation fk_PILOT_REQUEST_PILOT_MODELANALYSE10
     *
     * @var Application_Model_PilotModelanalyse
     */
    protected $_PilotModelanalyse;


    /**
     * Dependent relation fk_PILOT_DEFCOLUMN_PILOT_REQUEST10
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotDefcolumn
     */
    protected $_PilotDefcolumn;

    /**
     * Dependent relation fk_PILOT_REQUESTCOMP_PILOT_REQUEST10
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotRequestcomp
     */
    protected $_PilotRequestcomp;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_REQUEST'=>'IdPILOTREQUEST',
            'REQUESTTEXT'=>'REQUESTTEXT',
            'idPILOT_MODELANALYSE'=>'IdPILOTMODELANALYSE',
            'LABELRequest'=>'LABELRequest',
        	'servicedemande'=>'servicedemande',
        		'WITHCHART'=>'WITHCHART',
        		
        		
        ));

        $this->setParentList(array(
            'FkPILOTREQUESTPILOTMODELANALYSE10'=> array(
                    'property' => 'PilotModelanalyse',
                    'table_name' => 'PilotModelanalyse',
                ),
        ));

        $this->setDependentList(array(
            'FkPILOTDEFCOLUMNPILOTREQUEST10' => array(
                    'property' => 'PilotDefcolumn',
                    'table_name' => 'PilotDefcolumn',
                ),
            'FkPILOTREQUESTCOMPPILOTREQUEST10' => array(
                    'property' => 'PilotRequestcomp',
                    'table_name' => 'PilotRequestcomp',
                ),
        ));
    }

    
    
    
    /**
     * Sets column servicedemande
     *
     * @param int $data
     * @return Application_Model_PilotRequest
     */
    public function setservicedemande($data)
    {
    	$this->_servicedemande = $data;
    	return $this;
    }
    
    /**
     * Gets column servicedemande
     *
     * @return int
     */
    public function getservicedemande()
    {
    	return $this->_servicedemande;
    }
    
    /**
     * Sets column WITHCHART
     *
     * @param int $data
     * @return Application_Model_PilotRequest
     */
    public function setWITHCHART($data)
    {
    	$this->_servicedemande = $data;
    	return $this;
    }
    
    /**
     * Gets column WITHCHART
     *
     * @return int
     */
    public function getWITHCHART()
    {
    	return $this->_servicedemande;
    }
    
    
    
    /**
     * Sets column REQUESTTEXT
     *
     * @param text $data
     * @return Application_Model_PilotRequest
     */
    
    
    /**
     * Sets column idPILOT_REQUEST
     *
     * @param int $data
     * @return Application_Model_PilotRequest
     */
    public function setIdPILOTREQUEST($data)
    {
        $this->_IdPILOTREQUEST = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_REQUEST
     *
     * @return int
     */
    public function getIdPILOTREQUEST()
    {
        return $this->_IdPILOTREQUEST;
    }

    /**
     * Sets column REQUESTTEXT
     *
     * @param text $data
     * @return Application_Model_PilotRequest
     */
    public function setREQUESTTEXT($data)
    {
        $this->_REQUESTTEXT = $data;
        return $this;
    }

    /**
     * Gets column REQUESTTEXT
     *
     * @return text
     */
    public function getREQUESTTEXT()
    {
        return $this->_REQUESTTEXT;
    }

    /**
     * Sets column idPILOT_MODELANALYSE
     *
     * @param string $data
     * @return Application_Model_PilotRequest
     */
    public function setIdPILOTMODELANALYSE($data)
    {
        $this->_IdPILOTMODELANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELANALYSE
     *
     * @return string
     */
    public function getIdPILOTMODELANALYSE()
    {
        return $this->_IdPILOTMODELANALYSE;
    }

    /**
     * Sets column LABELRequest
     *
     * @param string $data
     * @return Application_Model_PilotRequest
     */
    public function setLABELRequest($data)
    {
        $this->_LABELRequest = $data;
        return $this;
    }

    /**
     * Gets column LABELRequest
     *
     * @return string
     */
    public function getLABELRequest()
    {
        return $this->_LABELRequest;
    }

    /**
     * Sets parent relation IdPILOTMODELANALYSE
     *
     * @param Application_Model_PilotModelanalyse $data
     * @return Application_Model_PilotRequest
     */
    public function setPilotModelanalyse(Application_Model_PilotModelanalyse $data)
    {
        $this->_PilotModelanalyse = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_MODELANALYSE'];
        }

        $this->setIdPILOTMODELANALYSE($primary_key);

        return $this;
    }

    /**
     * Gets parent IdPILOTMODELANALYSE
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotModelanalyse
     */
    public function getPilotModelanalyse($load = true)
    {
        if ($this->_PilotModelanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTREQUESTPILOTMODELANALYSE10', $this);
        }

        return $this->_PilotModelanalyse;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_REQUEST10
     *
     * @param array $data An array of Application_Model_PilotDefcolumn
     * @return Application_Model_PilotRequest
     */
    public function setPilotDefcolumn(array $data)
    {
        $this->_PilotDefcolumn = array();

        foreach ($data as $object) {
            $this->addPilotDefcolumn($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_REQUEST10
     *
     * @param Application_Model_PilotDefcolumn $data
     * @return Application_Model_PilotRequest
     */
    public function addPilotDefcolumn(Application_Model_PilotDefcolumn $data)
    {
        $this->_PilotDefcolumn[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_DEFCOLUMN_PILOT_REQUEST10
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotDefcolumn
     */
    public function getPilotDefcolumn($load = true)
    {
        if ($this->_PilotDefcolumn === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDEFCOLUMNPILOTREQUEST10', $this);
        }

        return $this->_PilotDefcolumn;
    }

    /**
     * Sets dependent relations fk_PILOT_REQUESTCOMP_PILOT_REQUEST10
     *
     * @param array $data An array of Application_Model_PilotRequestcomp
     * @return Application_Model_PilotRequest
     */
    public function setPilotRequestcomp(array $data)
    {
        $this->_PilotRequestcomp = array();

        foreach ($data as $object) {
            $this->addPilotRequestcomp($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_REQUESTCOMP_PILOT_REQUEST10
     *
     * @param Application_Model_PilotRequestcomp $data
     * @return Application_Model_PilotRequest
     */
    public function addPilotRequestcomp(Application_Model_PilotRequestcomp $data)
    {
        $this->_PilotRequestcomp[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_REQUESTCOMP_PILOT_REQUEST10
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotRequestcomp
     */
    public function getPilotRequestcomp($load = true)
    {
        if ($this->_PilotRequestcomp === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTREQUESTCOMPPILOTREQUEST10', $this);
        }

        return $this->_PilotRequestcomp;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotRequest
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotRequest());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotRequest::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTREQUEST() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_REQUEST = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTREQUEST()));
    }
}
